package drds.global_transaction.api.message_codec;

import drds.global_transaction.common.util.Nets;
import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Version
{

	public static final String current = "0.0.01";
	public static final Map<String, String> version_map = new ConcurrentHashMap<String, String>();

	public static String checkVersion(String version)
	{
		// TODO: check
		return version;
	}

	public static String getChannelVersion(Channel channel)
	{
		return version_map.get(Nets.getHostAddressAndPort(channel.remoteAddress()));
	}

	public static void putChannelVersion(Channel channel, String v)
	{
		version_map.put(Nets.getHostAddressAndPort(channel.remoteAddress()), v);
	}

	private Version()
	{

	}
}
